package com.sky.context;


/**
 * 设置局部线程
 */
public class BaseContext {

    public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    /**
     * 设置当前线程的线程局部变量值
     * @param id
     */
    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }

    /**
     * 获取当前线程所对应线程局部变量的值
     * @return
     */
    public static Long getCurrentId() {
        return threadLocal.get();
    }

    /**
     * 移除当前线程的线程局部变量
     */
    public static void removeCurrentId() {
        threadLocal.remove();
    }
}
